From 9c62f76963c0a6b0bc78f613077c75dc185a4301 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 24 May 2006 11:56:40 +0100 Subject: [PATCH] Use DEFINE_SPINLOCK in Linux drivers, conforming to coding style. Signed-off-by: Chris Wright --- linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 2 +- linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 2 +- linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c | 2 +- linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c | 2 +- linux-2.6-xen-sparse/drivers/xen/console/console.c | 2 +- linux-2.6-xen-sparse/drivers/xen/core/evtchn.c | 4 +--- linux-2.6-xen-sparse/drivers/xen/core/gnttab.c | 2 +- linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 4 ++-- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c index a0ea8d1160..b4ef5c1646 100644 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c @@ -67,7 +67,7 @@ static DECLARE_MUTEX(balloon_mutex); * Also protects non-atomic updates of current_pages and driver_pages, and * balloon lists. */ -spinlock_t balloon_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(balloon_lock); /* We aim for 'current allocation' == 'target allocation'. */ static unsigned long current_pages; diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c index 39daafe43c..cffb114f0d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c @@ -82,7 +82,7 @@ typedef struct { static pending_req_t *pending_reqs; static struct list_head pending_free; -static spinlock_t pending_free_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(pending_free_lock); static DECLARE_WAIT_QUEUE_HEAD(pending_free_wq); #define BLKBACK_INVALID_HANDLE (~0) diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c index 81d9c7fb8c..efa396142a 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c @@ -93,7 +93,7 @@ static struct block_device_operations xlvbd_block_fops = .ioctl = blkif_ioctl, }; -spinlock_t blkif_io_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(blkif_io_lock); static struct xlbd_major_info * xlbd_alloc_major_info(int major, int minor, int index) diff --git a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c index 6c93292e30..a414e50672 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c @@ -138,7 +138,7 @@ typedef struct { */ static pending_req_t pending_reqs[MAX_PENDING_REQS]; static unsigned char pending_ring[MAX_PENDING_REQS]; -static spinlock_t pend_prod_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(pend_prod_lock); /* NB. We use a different index type to differentiate from shared blk rings. */ typedef unsigned int PEND_RING_IDX; #define MASK_PEND_IDX(_i) ((_i)&(MAX_PENDING_REQS-1)) diff --git a/linux-2.6-xen-sparse/drivers/xen/console/console.c b/linux-2.6-xen-sparse/drivers/xen/console/console.c index de0a1e3457..9a2eaefdbf 100644 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c @@ -124,7 +124,7 @@ static int __init xencons_bufsz_setup(char *str) __setup("xencons_bufsz=", xencons_bufsz_setup); /* This lock protects accesses to the common transmit buffer. */ -static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(xencons_lock); /* Common transmit-kick routine. */ static void __xencons_tx_flush(void); diff --git a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c index 5632511d2b..5ab7e26b8e 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c @@ -51,7 +51,7 @@ * This lock protects updates to the following mapping and reference-count * arrays. The lock does not need to be acquired to read the mapping tables. */ -static spinlock_t irq_mapping_update_lock; +static DEFINE_SPINLOCK(irq_mapping_update_lock); /* IRQ <-> event-channel mappings. */ static int evtchn_to_irq[NR_EVENT_CHANNELS]; @@ -815,8 +815,6 @@ void __init xen_init_IRQ(void) int i; int cpu; - spin_lock_init(&irq_mapping_update_lock); - init_evtchn_cpu_bindings(); /* No VIRQ or IPI bindings. */ diff --git a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c index 0b288e61b2..2bab3f27be 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c @@ -81,7 +81,7 @@ EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer_ref); static grant_ref_t gnttab_list[NR_GRANT_ENTRIES]; static int gnttab_free_count; static grant_ref_t gnttab_free_head; -static spinlock_t gnttab_list_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(gnttab_list_lock); static grant_entry_t *shared = NULL; diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index a6f5080bfd..fb6b88e5e2 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -99,7 +99,7 @@ static spinlock_t net_schedule_list_lock; #define MAX_MFN_ALLOC 64 static unsigned long mfn_list[MAX_MFN_ALLOC]; static unsigned int alloc_index = 0; -static spinlock_t mfn_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(mfn_lock); static unsigned long alloc_mfn(void) { @@ -691,7 +691,7 @@ static void net_tx_action(unsigned long unused) static void netif_idx_release(u16 pending_idx) { - static spinlock_t _lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(_lock); unsigned long flags; spin_lock_irqsave(&_lock, flags); -- 2.30.2